package com.inexas.cu.client.mvp;

public class ListNotification implements Notification {
	public enum Type {
		/**
		 * 'size' elements have been inserted at 'index'
		 */
		INSERT,
		/**
		 * 'size' elements have been deleted at 'index'
		 */
		DELETE,
		/**
		 * The size and order of the list are the same but 'size' elements have
		 * been changed starting at element 'index'
		 */
		UPDATE,
		/**
		 * A modification has changed the list that is too complex to report as
		 * a notification. The reader should assume that all elements have
		 * changed. This notification is generated, for example as a result of a
		 * removeAll or retainAll operation on a list.
		 */
		RESET
	}

	private final Type type;
	private final int size, index;

	/**
	 * A change
	 * 
	 * @param type
	 *            the type of change that as taken place
	 * @param index
	 *            the index of the first element of the list that changed
	 * @param size
	 *            the number of elements that changed
	 */
	public ListNotification(Type type, int index, int size) {
		this.type = type;
		this.index = index;
		this.size = size;
	}

	public Type getType() {
		return type;
	}

	public int getSize() {
		return size;
	}

	public int getIndex() {
		return index;
	}
}
